
//第一步：引入createRouter
import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router'
import Home from '../pages/Home.vue'
import About from '../pages/About.vue'
import News from '../pages/News.vue'
import Detail from '../pages/Detail.vue'



//第二步：创建路由器
const router = createRouter({
  // history: createWebHistory(),
  history: createWebHashHistory(),
  routes: [
    {
      name: 'zhuye',
      path: '/home',
      component: Home
    },
    {
      name: 'guanyu',
      path: '/about',
      component: About
    },
    {
      name: 'xinwen',
      path: '/news',
      component: News,
      children: [
        {
          path: 'detail',
          component: Detail
        }
      ]
    },
    {
      path: '/',
      redirect: '/home'
    }
  ]
})


//将路由暴露
export default router
